﻿-- 新增班组并返回
CREATE procedure [dbo].[Groupinfo_AddReturn]
@bzfid varchar(20)=null,
@bzmc varchar(20),
@bz varchar(20)
as
declare @bzid varchar(20)
select @bzid=max(bzid) from Banz_Info where (@bzfid is null or bzfid=@bzfid)
if(@bzfid is null and @bzid is null)
begin
	set @bzid='01'
end
else
begin
	set @bzid=isnull(@bzfid,'')+isnull(right('00'+convert(varchar,right(@bzid,2)+1),2),'01')
end
insert into Banz_Info values(@bzid,@bzfid,@bzmc,@bz)
select * from Banz_Info where bzid=@bzid